<template>
    <div>
      <h1>管理员列表</h1>
      <table class="table table-bordered">
        <tbody>
            <tr class="bg-primary">
                <td>编号</td>
                <td>姓名</td>
                <td>手机号</td>
                <td>账号</td>
                <td>密码</td>
                <td>所属角色</td>
                <td>创建人</td>
            </tr>
            <tr v-for="item in list":key="item.Id">
                <td>{{item.Id}}</td>
                <td>{{item.Names}}</td>
                <td>{{item.Phone.substring(0,3)+'****'+item.Phone.substring(7)}}</td>
                <td>{{item.UserName}}</td>
                <td>{{item.UserPwd="****"}}</td>
                <td>{{item.Role}}</td>
                <td>{{item.CreatePeople}}</td>
            </tr>
        </tbody>
      </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue';
import axios from 'axios';
import moment from 'mooment';
import{useRouter,useRoute} from 'vue-router';
const router=useRouter();
const route=useRoute();

import {useStore} from '@/stores/user';
const a=useStore();

let list:any=ref([]);

onMounted(()=>{
    if(a.userinfo==1){
        getloginlist();
    }
    else{
        router.push('/login');
    }
    
})

const getloginlist=()=>{
    axios({
        url:'https://localhost:7268/api/Login/GetLoginlist',
        method:'get',
        params:list,
    })
    .then(res=>{
        console.log(res);
        list.value=res.data;
    })
}

</script>

<style scoped>

</style>